//
//  HealthGftKitVC.m
//  Ginix
//
//  Created by fzq on 2025/2/23.
//

#import "HealthGftKitVC.h"

@interface HealthGftKitVC ()
@property (nonatomic,strong) UIImageView * infoView;
@property (nonatomic,strong) UIScrollView * contentView;
@property (nonatomic,strong) UIImageView * iconView;
@property (nonatomic,strong) UIButton * enterBtn;

@property (nonatomic,strong) UILabel * nameLabel;
@property (nonatomic,strong) UILabel * timeLabel;

@end

@implementation HealthGftKitVC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setSubViewLayout];
}

-(void)setSubViewLayout{
    
    [self.view addSubview:self.infoView];
    [_infoView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_offset(CGSizeMake(330 * FMScaleX, 100 * FMScaleX));
        make.top.mas_offset(NavHeight + 10 * FMScaleX);
        make.centerX.equalTo(@0);
    }];
    [self.infoView addSubview:self.nameLabel];
    [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(20 * FMScaleX);
        make.top.mas_offset(20 * FMScaleX);
    }];
    [self.infoView addSubview:self.timeLabel];
    [_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.nameLabel);
        make.top.equalTo(self.nameLabel.mas_bottom).offset(10 * FMScaleX);
    }];
    
//    [self.view addSubview:self.enterBtn];
//    [_enterBtn mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.size.mas_offset(CGSizeMake(330 * FMScaleX, 40 * FMScaleX));
//        make.centerX.equalTo(@0);
//        make.bottom.mas_offset(-kSafeAreaHeight);
//    }];
    [self.view addSubview:self.contentView];
    [_contentView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(@0);
        make.top.equalTo(self.infoView.mas_bottom).offset(10 * FMScaleX);
        make.bottom.mas_offset(-kSafeAreaHeight);
    }];
    [self.contentView addSubview:self.iconView];
    
    if (UserInfoModel.shareInstance.userModel.isVip) {
        self.timeLabel.text = [NSString stringWithFormat:@"%@到期",UserInfoModel.shareInstance.userModel.medicalInsurance];
    }else{
        self.timeLabel.text = @"已到期";
    }
    
}

-(UIImageView *)infoView{
    
    if(!_infoView){
        _infoView = [[UIImageView alloc]init];
        _infoView.image = [UIImage imageNamed:@"Me_gift_bg_icon"];
    }
    return _infoView;
}

-(UILabel *)nameLabel{
    
    if (!_nameLabel) {
        _nameLabel = [[UILabel alloc]init];
        _nameLabel.text = @"家庭健康礼包";
        _nameLabel.font = Regular(20);
        _nameLabel.textColor = RDRGB(0xF2E4D0);
    }
    return _nameLabel;
}
-(UILabel *)timeLabel{
    
    if (!_timeLabel) {
        _timeLabel = [[UILabel alloc]init];
        _timeLabel.font = Regular(13);
        _timeLabel.textColor = RDRGB(0xF2E4D0);
    }
    return _timeLabel;
}

-(UIButton *)enterBtn{
    
    if(!_enterBtn){
        _enterBtn = [[UIButton alloc]init];
        [_enterBtn setBackgroundColor:RDRGB(0xAD7D62 )];
        [_enterBtn setCornerRadius:20 * FMScaleX];
        [_enterBtn setTitle:@"立即续费" forState:UIControlStateNormal];
        [_enterBtn setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
        _enterBtn.titleLabel.font = Bold(20);
    }
    return _enterBtn;
}

-(UIScrollView *)contentView{
    
    if(!_contentView){
        _contentView = [[UIScrollView alloc]init];
        _contentView.backgroundColor = UIColor.clearColor;
        _contentView.contentSize = CGSizeMake(WIDTH, 1800 * FMScaleX);
    }
    return _contentView;
}
-(UIImageView *)iconView{
    
    if(!_iconView){
        _iconView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, 1800 * FMScaleX)];
        _iconView.image = [UIImage imageNamed:@"Me_gift_icon"];
    }
    return _iconView;
}
@end
